Fix some JET errors around matching methods for send_connection_hdr(...) and send_msg_now(...) (underlying problem: the Worker(...) constructors might not always return a Worker)#180
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #180 +/- ##
=======================================
Coverage 79.47% 79.47%
=======================================
Files 10 10
Lines 1959 1959
=======================================
Hits 1557 1557
Misses 402 402 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| end | ||
|
|
||
| w = Worker(w_stub.id, r_s, w_s, manager; config=wconfig) | ||
| w = Worker(w_stub.id, r_s, w_s, manager; config=wconfig)::Worker |
There was a problem hiding this comment.
Would this also be fixed by adding ::Worker return annotations to the constructors?
There was a problem hiding this comment.
Hmmm. I think we need to look at this code closer.
The problematic line seems to be line 143 here:
Lines 140 to 152 in d06aa73
Line 143 is this line:
return map_pid_wrkr[id] map_pid_wrkr is a global constant. The problem (I think) is the type of map_pid_wrkr:
Line 850 in d06aa73
So when we index into map_pid_wrkr with map_pid_wrkr[id], how do we know whether map_pid_wrkr[id] is a Worker or a LocalProcess?
There was a problem hiding this comment.
Wow, I absolutely hate that 🤮 But something to fix another time... We could safely add an annotation to this constructor though, which I think is the one getting called here:
Line 124 in d06aa73
There was a problem hiding this comment.
I tried adding ::Worker to that constructor (the constructor starting on line 124), but that's not sufficient. Here's the source code for that constructor:
Lines 124 to 137 in 2adcd26
The problem is, on line 127, that constructor calls the Worker(::Int) constructor, which in turn calls the Worker(::Int, ::Any) constructor, and now we're in the Worker(::Int, ::Any) constructor, which is the constructor that includes the return map_pid_wrkr[id] line.
So, if I try adding ::Worker to the line 124 constructor, JET still complains, because Worker(::Int, ::Any) might return a LocalProcess.
…...)` and `send_msg_now(...)`
```
┌ create_worker(manager::Distributed.ClusterManager, wconfig::Distributed.WorkerConfig) @ Distributed ~/Distributed.jl/src/cluster.jl:709
│ no matching method found `send_connection_hdr(::Distributed.LocalProcess, ::Bool)` (1/2 union split): Distributed.send_connection_hdr(w::Union{Distributed.LocalProcess, Distributed.Worker}, true)
└────────────────────
```
```
┌ create_worker(manager::Distributed.ClusterManager, wconfig::Distributed.WorkerConfig) @ Distributed ~/Distributed.jl/src/cluster.jl:712
│ no matching method found `send_msg_now(::Distributed.LocalProcess, ::Distributed.MsgHeader, ::Distributed.JoinPGRPMsg)` (1/2 union split): Distributed.send_msg_now(w::Union{Distributed.LocalProcess, Distributed.Worker}, Distributed.MsgHeader(Distributed.RRID(0, 0)::Distributed.RRID, ntfy_oid::Distributed.RRID)::Distributed.MsgHeader, join_message)
└────────────────────
```
(cherry picked from commit 3e74cbc)
1eaff36 to
a18f0b9
Compare
send_connection_hdr(...) and send_msg_now(...)send_connection_hdr(...) and send_msg_now(...) (underlying problem: the Worker(...) constructors might not always return a Worker)
Cherry-picked out of #164
The underlying problem seems to be that the
Worker(...)constructors might not always return aWorker. See also: #182